app.controller('loginregController' , function($scope, $http ,utilService){
	$scope.login = function(){
		utilService.ajax({
			url: '../../api/user_login.php',
			method: 'get',
			data: {
				username: $scope.username,
				password: $scope.password
			},
			ok: function(response) {
				if (response.success) {
					console.log(response);
					$('.myname').html('欢迎你，'+response.data[0].realname);
					layer.msg('登录成功', {
						offset: 't',
						anim: 6
					});
					if(response.data[0].type ==1){
						location.href = "index.html#/goods";
					}else if(response.data[0].type ==9){
						location.href = "index.html#/users";
					}
//					$scope.goods = response.data;
//					$scope.totalPage = Math.ceil(response.total / $scope.size);
//					$scope.pageArr = _.range($scope.totalPage);
				} else {
					// ...
				}
			}
		}, $scope);
	}
});